from tkinter import *

root=Tk()

#1.红色部分是Radiobutton第一种写法
#v=IntVar()

#Radiobutton(root,text="one",variable=v,value=1).pack(anchor=W)
#Radiobutton(root,text="two",variable=v,value=2).pack(anchor=W)
#Radiobutton(root,text="three",variable=v,value=3).pack(anchor=W)


#2.第二种Radiobutton用循环来写
LANGS=[
    ("python",1),
    ("js",2),
    ("lau",3),
    ("ruby",4)]

v=IntVar()
v.set(1)

for lang,num in LANGS:
    b=Radiobutton(root,text=lang,variable=v,value=num,indicatoron=False)
    # indicatoron=False是把单选框的圆圈去掉
    b.pack(fill=X)
    # fill=X是横向填充，Y是竖向填充


mainloop()
